import type { GreasyForkElements } from '../../../../../../../../types/constants/personalization/greasy_fork'
import {
  AppStyleCollections,
  PAGE_ELEMENTS,
  PROJECT_PREFIX,
  SUPPORTED_PLATFORMS,
} from '../../../../../../../../types/constants'
import { CommonPage } from './common'

// 测试链接：https://greasyfork.org/zh-CN/libraries
export class NotFoundPage {
  elements: GreasyForkElements = PAGE_ELEMENTS[SUPPORTED_PLATFORMS.GREASY_FORK]
  private static instance: NotFoundPage
  private commonPage: CommonPage = CommonPage.getInstance()

  /**
   * 获取单例实例
   */
  public static getInstance(): NotFoundPage {
    if (!NotFoundPage.instance) {
      NotFoundPage.instance = new NotFoundPage()
    }
    return NotFoundPage.instance
  }

  init(): void {
    $('#error-show-ea').addClass(AppStyleCollections.Hide.ELEMENT)
  }

  getMainStyles(): string {
    return `
.text-content {
  background-color: var(--${PROJECT_PREFIX}-theme-bg-base) !important;
  border: none !important;
  box-shadow: none !important;
  margin-top: 0 !important;
  
  p {
    margin-top: 0 !important;
    padding-top: 16px !important;
    color: var(--${PROJECT_PREFIX}-theme-text-secondary) !important;
    
    a {
      ${this.commonPage.linkStyles()}
    }
  }
}
`
  }
}
